package cn.gok.springboot.Controller;

import cn.gok.springboot.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName AnoController
 * @Description TODO
 * @Author HP
 * @Date 11:30 2022/7/14
 * @Version 1.0
 * controller的注解
 **/
@RestController
public class AnoController {
    @Autowired
    private Student student;
//    并没有指定请求方式
    @RequestMapping("/method1")
    public Student method1(@RequestBody Student student1){
        return student;
    }
//    只能使用get进行请求
    @GetMapping("/method2")
    public String method2(){
        return "method2";
    }
    //    只能使用Post进行请求
    @PostMapping("/method3")
    public String method3(){
        return "method3";
    }
//    指定信息
    @RequestMapping(value = "/method4",method = RequestMethod.GET)
    public String method4(){
        return "method4";
    }
}
